<?php

class CountHiveTableAction extends HiveAction {
	
	public function __construct($name, $cmd, $hiveClient) {		
		parent::__construct($name, $cmd, $hiveClient);
	}
	
	public function execute(ezcWorkflowExecution $execution) {
		$source	= CJSON::decode($execution->getVariable('source'));
    	$tableName = $source['storage'];
    	
    	$this->cmd = $this->concreteParams($this->cmd, array(
    		':tableName'	=>	$tableName,
    		)
    	);
 		$status = parent::execute($execution);
 		if($status) {
 			$execution->setVariable('count', $this->getResult());
 		}
 		return $status;
    }
}
